#ifndef COMPILERFACTORY_H
#define COMPILERFACTORY_H

#include <wx/arrstr.h>
#include "compiler.h"

class Compiler;

WX_DEFINE_ARRAY( Compiler*, CompilersArray );

class CompilerFactory {
  public:
    static size_t GetCompilersCount();
    static Compiler* GetCompiler( size_t index );
    static Compiler* GetCompiler( const wxString& id );
    static Compiler* GetCompilerByName( const wxString& title );
    static int GetCompilerIndex( const wxString& id );
    static int GetCompilerIndex( Compiler* compiler );
    static bool IsValidCompilerID( const wxString& id ) { return GetCompilerIndex( id ) != -1; }
    static bool CompilerInheritsFrom( const wxString& id, const wxString& from_id );
    static bool CompilerInheritsFrom( Compiler* compiler, const wxString& from_id );
    static void RegisterCompiler( Compiler* compiler );
    static void RegisterUserCompilers();
    static Compiler* CreateCompilerCopy( Compiler* compiler, const wxString& newName );
    static void RemoveCompiler( Compiler* compiler );
    static void UnregisterCompilers();
    static wxString GetCompilerVersionString( const wxString& Id );
    static void SaveSettings();
    static void LoadSettings();
    static const wxString& GetDefaultCompilerID();
    static Compiler* GetDefaultCompiler();
    static void SetDefaultCompiler( size_t index );
    static void SetDefaultCompiler( const wxString& id );
    static void SetDefaultCompiler( Compiler* compiler );
    static Compiler* SelectCompilerUI( const wxString& message = _T( "Select compiler" ), const wxString& preselectedID = wxEmptyString );
  private:
    static CompilersArray Compilers;
    static Compiler* s_DefaultCompiler;
};

#endif
